require File.dirname(__FILE__) + '/document'
require File.dirname(__FILE__) + '/suffix'

class Fragment
  attr_reader :suffix, :length

  def initialize(suffix, length)
    @suffix, @length = suffix, length
  end
  
  def starts_with(other)
    return false if other.length > @length
    
    (0...other.length).each do |index|
      return false unless @suffix[index] == other.suffix[index]
    end
    
    true
  end
end
